#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# task1: print the rhombus
# no  left-space  total-space   star     (rule)
# 1       3           6          1       6+1=7
# 2       2           4          3       4+3=7
# 3       1           2          5       2+5=7
# 4       0           0          7       0+7=7
# 5       1           2          5       2+5=7
# 6       2           4          3       4+3=7
# 7       3           6          1       6+1=7
# size = 7
# left-space --> generate  [-3, 3]
# star = size - (2 * left-space)

#    *
#   ***
#  *****
# *******
#  *****
#   ***
#    *


def rhombus_fix():
    size = 7
    start = size // 2
    end = start + 1
    # generate [-3, 3]
    for i in range(-start, end):
        if i < 0:
            i = -i
        print(' ' * i, '*' * (size - 2 * i))


def rhombus_abs_fix():
    size = 7
    start = size // 2
    end = start + 1
    for i in range(-start, end):
        print('{}{}'.format(' ' * abs(i), '*' * (size - abs(i) * 2)))


def rhombus(num):
    start = num // 2
    end = start + 1
    for i in range(-start, end):
        print('{}{}'.format(' ' * abs(i), '*' * (num - 2 * abs(i))))


def rhombus_1(num):
    start = num // 2
    end = start + 1
    for i in range(-start, end):
        print('{:^{}}'.format('*' * (num - 2 * abs(i)), num))


# task2
# print the triangle
# *******
#  *****
#   ***
#    *
#   ***
#  *****
# *******


# my answer
def triangle():
    total = 7
    for i in range(-total, total + 1, 2):
        if i == 1:
            continue
        print(' ' * ((total - abs(i)) // 2), abs(i) * '*')


# teacher answer
def triangle_1():
    total = 7
    for i in range(-3, 4):
        print('{:^{}}'.format('*' * (2 * abs(i) + 1), total))


# task3
# print the light
#    *
#   **
#  ***
# *******
#    ***
#    **
#    *


def light():
    total = 7
    start = total // 2
    end = start + 1
    for i in range(-start, end):
        if i < 0:
            print('{:>{}}'.format('*' * (end - abs(i)), end))
        elif i > 0:
            print('{}{:<{}}'.format(' ' * start, '*' * (end - abs(i)), end))
        else:
            print('{}'.format('*' * total))


light()
